package com.zwps.common.tool;

import java.util.regex.Pattern;

public class RegexTool {

    /**
     * 密码必须包含大小写字母、数字、特殊符号，且长度为8~16
     */
    public static String REGEX_PASSWORD = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%&*]).{8,16}$";

    public static boolean checkPassword(String password) {
        return checkPassword(password, REGEX_PASSWORD);
    }
    
    public static boolean checkPassword(String password, String regex) {
        return Pattern.compile(regex).matcher(password).matches();
    }
}
